
import cloud from '@lafjs/cloud'
import nw from "nw-lafjs";
import {fail, ok} from "@/utils/responseUtil";
const db = cloud.database()
const _ = db.command
export default async function (ctx: FunctionContext) {
  let user = ctx.user.admin

  let num =  await nw.db.update({
    dbName:"admin",
    whereJson:{
      _id: _.eq(user),
    },
    dataJson:{
      token:""
    }
  });
  if (num<=0){
    return fail("登出失败失败")
  }

  return ok("登出成功")

}
